package com.gopay.checkorder.dao.impl;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.type.NullableType;
import org.springframework.stereotype.Repository;

import com.gopay.checkorder.dao.CheckBcdlSendBankLogDAO;
import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.domain.bank.CheckBcdlSendBankLog;
/**
 * 
 * @author lizheng
 *
 */
@Repository(value = "checkBcdlSendBankLogDAO")
public class CheckBcdlSendBankLogDAOImpl extends BaseDAOImpl<CheckBcdlSendBankLog, String> implements CheckBcdlSendBankLogDAO {

	  @Override
	    public CheckBcdlSendBankLog getLogByGopayOrderId(String gopayOrderId) {
	        String hql = "from CheckBcdlSendBankLog where gopayOrderId = :orderId";

	        Map<String, Object> params = new HashMap<String, Object>();
	        params.put("orderId", gopayOrderId);

	        List<CheckBcdlSendBankLog> list = this.findByHql(hql, params);
	        if (list != null && list.size() > 0) {
	            return list.get(0);
	        }

	        return null;
	    }
	
	  @Override
		public int delLogByGopayOrderId(String  gopayOrderId) {
			String  sql = "delete from checkorder_bcdl_send_bank_log where gopay_order_id = :orderId";
			Map<String, Object> params = new HashMap<String, Object>();
		    params.put("orderId", gopayOrderId);
			return this.updateBySql(sql, params);
		}
	  
}
